import http from "../util/httpRequest.js"

//  订单支付，微信小程序下单
export function orderPay(params) {
	params.method = "POST"
	params.path = "/pay/orderPay/" + params.orderNo + "?payType=" + params.payType
	params.testData = function() {
		if (params.payType == "JSAPI") {
			return {
				"appid": "wxa873cxxxxxxxxxxx",
				"mch_id": "1618xxxxxxx",
				"nonce_str": "pxlmOdaAnXCtMn0M",
				"prepay_id": "wx22200456595239fa85f9d48fb2686a0000",
				"result_code": "SUCCESS",
				"return_code": "SUCCESS",
				"return_msg": "OK",
				"sign": "13175AF8FB1E1AC50B27BB997DBA935A",
				"trade_type": "JSAPI"
			}
		}
		console.error("不支持的支付方式：" + params.payType)
		return {}
	}
	http(params)
}
